package com.atwork.wuhua.ui.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.atwork.wuhua.R;
import com.atwork.wuhua.base.BaseActivity;

import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.reactivex.Observable;
import io.reactivex.functions.Consumer;

public class FeedbackActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ed_evaluate)
    EditText edEvaluate;

    @Override
    protected boolean isBindEventBus() {
        return false;
    }

    @Override
    public int intiLayout() {
        return R.layout.activity_feedback;
    }

    @Override
    public void initView() {
        tvTitle.setText("意见反馈");
    }

    @Override
    public void initData() {

    }


    @SuppressLint("CheckResult")
    @OnClick({R.id.img_left, R.id.tv_action})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_left:
                finish();
                break;
            case R.id.tv_action:
                if (edEvaluate.getText().toString().length() > 0) {
                    showLoading();
                    Observable.timer(1, TimeUnit.SECONDS)
                            .subscribe(new Consumer<Long>() {
                                @Override
                                public void accept(Long aLong) throws Exception {
                                    hideLoading();
                                    showToast("提交成功");
                                    finish();
                                }
                            });
                } else {
                    showToast("请输入意见或建议！");
                }

                break;
        }
    }
}
